<template>
  <div>
    <div class="card mb-3" v-for="(item) of data" :key="item.id">
      <div class="card-block">
        <h4 class="card-title">{{item.title}}</h4>
        <p class="card-text">{{item.description}}</p>
        <router-link :to="`/details${item.id}`">阅读全文</router-link>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ["limit", "page"],
  data() {
    return {
      data: "",
    };
  },
  mounted() {
    // 组件加载后向服务器请求数据 带参
    this.axios
      .get("/article/list", {
        params: {
          page: this.page,
          limit: this.limit,
        },
      })
      .then((res) => {
        console.log(res.data);
        this.data = res.data;
      });
  },
};
</script>

<style></style>
